package com.zhiyin.seal.util;

import java.util.UUID;

public class UUIDUtil {
    /**
     * 获取系统UUID对象
     * @return
     */
    private static UUID getUUIDObject() {
        return UUID.randomUUID();
    }
    /**
     * 获取UUID字符串
     * @param with_ 是否带"-"
     * @return UUID字符串
     */
    public static String getUUIDString(Boolean with_) {
        UUID uuid = getUUIDObject();
        if(with_) {
            return uuid.toString();
        }
        else {
            return uuid.toString().replaceAll("-", "");
        }
    }

    /**
     * 获取UUID字符串(不带'-')
     * @return
     */
    public static String getUUIDString(){
        return getUUIDString(false);
    }
}
